function PlotOrbitMultiple_COV(R,COV) % R coming in as a cell of states.
    
    Re = 6378.136;
    %[km]Mean equatorial radius of the Earth.
    for ii = 1:length(R)
        R{ii} = R{ii} / Re;
        %[Earth radii]Converts all positions from kilometers to Earth radii.
    end
    n = size(R,2);
    %[]Number of points that will be plotted.
    
    Extent = 3;
    %[]Axes extents.
    
    [xe,ye,ze] = ellipsoid(0,0,0,1,1,1,50);
    %[Earth radii]Determines the coordinates of the Earth.
    
    [x1,y1,z1] = ellipsoid(R{1}(1),R{1}(2),R{1}(3),COV{1}(1,1)/Re,COV{1}(2,2)/Re,COV{1}(3,3)/Re);
    [x2,y2,z2] = ellipsoid(R{2}(1),R{2}(2),R{2}(3),COV{2}(1,1)/Re,COV{2}(2,2)/Re,COV{2}(3,3)/Re);
    %[] Ellipsoid of the Pc
    
    Earth = imread('Earth.bmp');
    %[]Loads the image of the Earth.
    
    ScreenSize = get(0,'ScreenSize');
    %[]Determines the location and dimensions of the current monitor.
    
    Window = figure( ...
        'Color','w', ...
        'Name','ORBIT IN THREE DIMENSTIONS', ...
        'NumberTitle','Off', ...
        'OuterPosition',ScreenSize);
    %[]Opens a new window and adjusts its properties.
    
    Axes = axes( ...
        'CameraPosition',Extent*[1.2,1.2,1.2], ...
        'CameraTarget',[0,0,0], ...
        'FontName','Arial', ...
        'FontSize',8, ...
        'FontWeight','Bold', ...
        'Parent',Window, ...
        'PlotBoxAspectRatio',[1,1,1], ...
        'NextPlot','Add', ...
        'XGrid','On', ...
        'YGrid','On', ...
        'ZGrid','On', ...
        'XLim',Extent * [-1,1], ...
        'YLim',Extent * [-1,1], ...
        'ZLim',Extent * [-1,1], ...
        'XTick',Extent * (-1:0.2:1), ...
        'YTick',Extent * (-1:0.2:1), ...
        'ZTick',Extent * (-1:0.2:1));
    %[]Adds an axes to the specified window and adjusts its properties.
    
    surface(xe,ye,-ze, ...
        'CData',Earth, ...
        'EdgeColor','None', ...
        'FaceColor','TextureMap', ...
        'FaceAlpha','0.3',...
        'Parent',Axes);
    
    surface(x1,y1,z1,'FaceColor','flat','FaceAlpha','0.3','LineStyle','none','Parent',Axes)
    surface(x2,y2,z2,'FaceColor','flat','FaceAlpha','0.3','LineStyle','none','Parent',Axes)
    %[]Adds a plot to the specified axes and adjusts its properties.
    for ii = 1:length(R)
        plot3(R{ii}(1,:),R{ii}(2,:),R{ii}(3,:), ...
            'Color','k', ...
            'LineStyle','None', ...
            'Marker','.', ...
            'Parent',Axes);
        %[]Adds a plot to the specified axes and adjusts its properties.
    end
    
%     plot3([0,Extent],[0,0],[0,0], ...
%         'Color','r', ...
%         'Linestyle','-', ...
%         'LineWidth',3, ...
%         'Marker','None', ...
%         'Parent',Axes);
%     %[]Adds a plot to the specified axes and adjusts its properties.
%     
%     plot3([0,0],[0,Extent],[0,0], ...
%         'Color','r', ...
%         'Linestyle','-', ...
%         'LineWidth',3, ...
%         'Marker','None', ...
%         'Parent',Axes);
%     %[]Adds a plot to the specified axes and adjusts its properties.
%     
%     plot3([0,0],[0,0],[0,Extent], ...
%         'Color','r', ...
%         'Linestyle','-', ...
%         'LineWidth',3, ...
%         'Marker','None', ...
%         'Parent',Axes);
%     %[]Adds a plot to the specified axes and adjusts its properties.
    
    xlabel( ...
        'Earth Radii', ...
        'FontSize',16, ...
        'Parent',Axes);
    %[]Adds a label to the specified axis.
    
    ylabel( ...
        'Earth Radii', ...
        'FontSize',16, ...
        'Parent',Axes);
    %[]Adds a label to the specified axis.
    
    zlabel( ...
        'Earth Radii', ...
        'FontSize',16, ...
        'Parent',Axes);
    %[]Adds a label to the specified axis.
    
%     text( ...
%         'BackGroundColor','w', ...
%         'Color','r', ...
%         'FontName','Arial', ...
%         'FontSize',12, ...
%         'FontWeight','Bold', ...
%         'HorizontalAlignment','Center', ...
%         'LineStyle','None', ...
%         'Parent',Axes, ...
%         'Position',[Extent,0,0], ...
%         'String','X', ...
%         'VerticalAlignment','Middle');
%     %[]Adds a text box to the specified axes and adjusts its properties.
%     
%     text( ...
%         'BackGroundColor','w', ...
%         'Color','r', ...
%         'FontName','Arial', ...
%         'FontSize',12, ...
%         'FontWeight','Bold', ...
%         'HorizontalAlignment','Center', ...
%         'LineStyle','None', ...
%         'Parent',Axes, ...
%         'Position',[0,Extent,0], ...
%         'String','Y', ...
%         'VerticalAlignment','Middle');
%     %[]Adds a text box to the specified axes and adjusts its properties.
%     
%     text( ...
%         'BackGroundColor','w', ...
%         'Color','r', ...
%         'FontName','Arial', ...
%         'FontSize',12, ...
%         'FontWeight','Bold', ...
%         'HorizontalAlignment','Center', ...
%         'LineStyle','None', ...
%         'Parent',Axes, ...
%         'Position',[0,0,Extent], ...
%         'String','Z', ...
%         'VerticalAlignment','Middle');
%     %[]Adds a text box to the specified axes and adjusts its properties.
    
end
%===================================================================================================